import style from '../../styles/h-list.module.scss'
import Link from 'next/link'
import { formatDatetime } from '../../utils';
export default function HomeList(props) {
    const { momentList } = props;
    return (
        <div className={style.homelistWrapper}>
            {
                momentList.map(item => (
                    <Link key={item.id} href="/detail/[id]" as={`/detail/${item.id}`}>
                        <div className={style.listItem}>
                            <div className={style.imgBox}>
                                <img src={item.img_url} alt="" />
                            </div>
                            <div className={style.item_content}>
                                <h2>{item.title} </h2>
                                <p>{item.introduce}</p>
                                <div>{formatDatetime(item.create_time, 'yyyy-MM-dd hh:mm:ss')}</div>
                            </div>
                        </div>
                    </Link>
                ))
            }
        </div>
    )
}
